package com.cqs.example.io.serial.utils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

/**
 * fastjson序列化
 */
public class FastJsonSerializer {

    public static <T> JSON serialize(T t) {
        return (JSON)JSONObject.toJSON(t);
    }


    public static <T> T deserialize(JSON json, Class<T> cls) {
        return JSONObject.parseObject(json.toJSONString(), cls);
    }

}
